using System.Collections;
using System.Collections.Generic;
using PureStateMachine;
using UnityEngine;

// Choose hero
public class TSPlace : PState
{
    public TSPlace(PStateBrain brain) : base(brain)
    {
    }

    public override string Name => "Place";

    public override void StateInit()
    {
        ;
    }

    public override void StateStart()
    {
        LevelManager.instance.OnPlaceStart();
        // 读取关卡布局
    }

    public override void StateUpdate()
    {
        
    }

    public override void StateEnd()
    {
        /* foreach (GridNode node in GridManager.instance.grids)
        {
            node.Pawn?.InitByCardData();
        } */
        foreach (GridNode node in GridManager.instance.grids)
        {
            node.Pawn?.InitByCard();
        }
        foreach (GridNode node in GridManager.instance.grids)
        {
            node.Pawn?.ExecuteRoots();
        }
        foreach (GridNode node in GridManager.instance.grids)
        {
            node.Pawn?.InitFeaturesListen();
        }
    }

    public void OnPlaceOver()
    {
        TransferTo("Battle");
    }
}
